home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
edit
/
xvidoc.zip
/
SOURCE.LST
< prev
next >
Wrap
File List
|
1992-07-28
|
56KB
|
1,519 lines
Notes on the Xvi Source Code
Chris Downey
John Downey
Xvi (pronounced _e_c_k_s-_v_e_e-_e_y_e) is a free, portable,
multi-window implementation of the popular UNIX|- editor
vi.
This document contains information on how to port xvi
to systems not currently supported. It also explains
how the xvi source code is arranged into modules, and
explains some of the data structures which are used, so
that modifications may be made if and when necessary to
the editor itself.
_1. _I_N_T_R_O_D_U_C_T_I_O_N
Xvi is intended to be portable to just about any system. This is
one of the central reasons for its existence; the authors wish to
be able to use the same editor everywhere.
The main body of the editor is (supposedly) fully portable,
relying only on standard facilities defined by the White Book,
and on a set of _p_r_i_m_i_t_i_v_e_s which are provided by a set of one or
more modules for each operating system. If ___S_T_D_C__ is defined,
certain ANSI C facilities will be used, but the editor will
compile with non-ANSI compilers.
Therefore, in order to port xvi to a new system, all that is
necessary is to provide the defined set of _p_r_i_m_i_t_i_v_e_s, and then
build the editor. Or at least, that's the idea; we have refined
the set of primitives as we port the editor to new environments,
and it's getting pretty easy now.
The rest of this document is divided into sections as follows:
_S_e_c_t_i_o_n _2: _S_y_s_t_e_m-_S_p_e_c_i_f_i_c _M_o_d_u_l_e_s
This section deals with the layout of source files and
makefiles which you will have to deal with when porting xvi.
_S_e_c_t_i_o_n _3: _P_r_i_m_i_t_i_v_e_s _P_r_o_v_i_d_e_d _b_y _x_v_i
Discusses what primitives are provided by the main body of
the editor source code for use by the system interface code.
_________________________
|- UNIX is a trademark of Bell Laboratories.
_2_5_t_h _S_e_p_t_e_m_b_e_r _1_9_9_2 _P_a_g_e _1
_2 _X_v_i _S_o_u_r_c_e _C_o_d_e _N_o_t_e_s
_S_e_c_t_i_o_n _4: _S_y_s_t_e_m _I_n_t_e_r_f_a_c_e
Explains the primitives which need to be provided in order
to make xvi work.
_S_e_c_t_i_o_n _5: _D_a_t_a _S_t_r_u_c_t_u_r_e_s
Details the internal data types used in the editor, and any
functions available for operating on those types.
_S_e_c_t_i_o_n _6: _S_o_u_r_c_e _F_i_l_e_s
Lists the source files comprising the editor, and explains
what functionality is provided by each one.
_2. _S_Y_S_T_E_M-_S_P_E_C_I_F_I_C _M_O_D_U_L_E_S
The system-specific code normally consists of three (or more)
files; a ".c" file, a ".h" file, and a makefile. For example:
_q_n_x._c
_q_n_x._h
_m_a_k_e_f_i_l_e._q_n_x
comprise the system-specific module for the QNX operating system.
In most cases, the system-specific code is divided into two or
more modules, where one (called the _s_y_s_t_e_m _i_n_t_e_r_f_a_c_e _m_o_d_u_l_e) is
concerned with general interactions with the operating system and
the other (called the _t_e_r_m_i_n_a_l _i_n_t_e_r_f_a_c_e _m_o_d_u_l_e) is designed for
a specific interface to a display and keyboard (and possibly, a
mouse).
For example, the generic UNIX implementation has _u_n_i_x._c and
_u_n_i_x._h for the system interface module, and _t_e_r_m_c_a_p._c and
_t_e_r_m_c_a_p._h for the terminal interface module; this should work
reasonably with any full-duplex terminal that can be described in
the _t_e_r_m_c_a_p database. On consoles with memory-mapped displays,
or systems with graphic user interfaces, however, it may be
possible to achieve faster display updating, and perhaps other
benefits, by replacing the _t_e_r_m_c_a_p module with another one that
makes better use of whatever facilities are available. For
instance, there is an experimental version for SunView, which
allows mouse input on Sun workstations running the SunView window
system.
On the other hand, the _t_e_r_m_c_a_p-specific routines might
conceivably be useful on some other operating systems (such as
VMS), so in general it seemed a good idea to make the _t_e_r_m_c_a_p-
specific routines a separate module.
The current MS-DOS implementation has a separate terminal
interface module, which is designed specifically for IBM PC
compatible computers. This is in the files
_P_a_g_e _2 _2_5_t_h _S_e_p_t_e_m_b_e_r _1_9_9_2
_X_v_i _S_o_u_r_c_e _C_o_d_e _N_o_t_e_s _3
_i_b_m_p_c__a._a_s_m
_i_b_m_p_c__c._c
_i_b_m_p_c._h
The first of these is written in assembly language because there
are not enough routines common to the various MS-DOS C compilers
which reliably access the display and keyboard at a low enough
level.
The hardware-independent system interface module for MS-DOS is in
_m_s_d_o_s__a._a_s_m
_m_s_d_o_s__c._c
_m_s_d_o_s._h
The first of these is written in assembly language for the same
reason as is _i_b_m_p_c__a._a_s_m.
Theoretically, different terminal interface modules could be
written for MS-DOS systems running on hardware which is not IBM-
compatible but, unfortunately, such systems seem to be virtually
extinct nowadays.
Sometimes more than one makefile is provided, as in the case of
UNIX, where different versions work in slightly different ways.
It is, of couse, not necessary to provide all - or any - of these
files for a particular implementation; this is just a convention.
The makefile(s) for each system determine what files are used in
the compilation of the editor.
The following porting modules are available at present:
_2_5_t_h _S_e_p_t_e_m_b_e_r _1_9_9_2 _P_a_g_e _3
_4 _X_v_i _S_o_u_r_c_e _C_o_d_e _N_o_t_e_s
________________________________________________________________
| System | Makefile | Source Files |
|________________________|_______________|_________________________|
| UNIX | | |
| BSD | makefile.bsd| unix.[ch] termcap.[ch]|
| System V |- | makefile.usg| unix.[ch] termcap.[ch]|
| AIX | makefile.aix| unix.[ch] termcap.[ch]|
| ULTRIX | makefile.ult| unix.[ch] termcap.[ch]|
| Xenix |- | makefile.xen| unix.[ch] termcap.[ch]|
| POSIX (e.g. BSDI) | makefile.pos| unix.[ch] termcap.[ch]|
| SunOS | makefile.sun| unix.[ch] termcap.[ch]|
| SunView | makefile.sv | unix.[ch] sunview.h |
| | | sunfront.c sunback.c |
| | | xvi.icn |
|________________________|_______________|_________________________|
| | | |
| MS-DOS | | msdos_c.c msdos.h |
| | | ibmpc_c.c ibmpc.h |